package com.example.fist.control;


import com.example.fist.FistApplication;


import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

@RestController
@CrossOrigin(allowCredentials = "true")
    public class helle {
        @RequestMapping("/hello")
        String home(HttpSession session,String name,String pass) {
            System.out.println(name);
            System.out.println(pass);
            session.setAttribute("s", "woowo");
            return "Hello World!"+name+pass;

        }
    @RequestMapping("/is")
    String home(String name,HttpSession session) {

     String  naame=  (String) session.getAttribute(name);
        System.out.println(naame);

        return "Hello World!"+naame;

    }


    @RequestMapping("/islogin")
    String islogin(String name,String cook,HttpSession session, HttpServletRequest request, HttpServletResponse response) {


        System.out.println(session.getId()+"============");

        if(session.getAttribute("登录")!=null){

            System.out.println("已经登录登录");

            return "已经登录登录";
        }

        System.out.println("未登录登录");
        return "未登录登录";


    }

    }

